/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.route.system.session;

import com.route.system.entity.RpsStation;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author neco
 */
@Stateless
public class RpsStationFacade extends AbstractFacade<RpsStation> {
    @PersistenceContext(unitName = persistenceUnitName)
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public RpsStationFacade() {
        super(RpsStation.class);
    }
    public List<RpsStation> completeByName(String value) {
        Query query = getEntityManager().createNamedQuery("RpsStation.completeByStationName", RpsStation.class);
        query.setParameter("stationName", value);
        return query.getResultList();
    }
    public List<RpsStation> completeByNameAndWithOutStationId(String value,Integer stationId) {
        Query query = getEntityManager().createNamedQuery("RpsStation.completeByStationNameAndWithoutId", RpsStation.class);
        query.setParameter("stationName", value);
        query.setParameter("stationId", stationId);
        return query.getResultList();
    }
    
}
